home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / tutor / cptuts22.arj / VEHICLE.CPP < prev    next >
C/C++ Source or Header  |  1992-01-20  |  592b  |  33 lines

  1.                                   // Chapter 7 - Program 2
  2. #include "vehicle.h"
  3.  
  4.  
  5.  
  6.               // initialize to any data desired
  7. void vehicle::initialize(int in_wheels, float in_weight)
  8. {
  9.    wheels = in_wheels;
  10.    weight = in_weight;
  11. }
  12.  
  13.  
  14.               // get the number of wheels of this vehicle
  15. int vehicle::get_wheels()
  16. {
  17.    return wheels;
  18. }
  19.  
  20.  
  21.               // return the weight of this vehicle
  22. float vehicle::get_weight()
  23. {
  24.    return weight;
  25. }
  26.  
  27.  
  28.               // return the weight on each wheel
  29. float vehicle::wheel_loading()
  30. {
  31.    return weight/wheels;
  32. }
  33.